<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
</head>
<body>
<?php
include "connection.php";

 

$nid = str_replace(" ","",$_GET['nId']);
$user_name = str_replace(" ","",$_REQUEST['user_name']);
$user_id = str_replace(" ","",$_REQUEST['user_id']);
$department = str_replace(" ","",$_REQUEST['department']);
$account = str_replace(" ","",$_REQUEST['account']);


if(
($nid=="")||
($user_name=="")||
($user_id=="")||
($department=="")
)
{
?>
<script type="text/javascript">
    alert("数据格式出错，修改失败");
    document.location = "<? echo '../admin_useredit.php?nId='.$nid ?>";
</script>	
<?
;}

else
{
$tableUser = "user";

$sql = "update $tableUser set user_name='$user_name',user_id='$user_id',account='$account',department='$department' where nid='$nid'";
$query = mysql_query($sql) or die ("修改失败，请返回！");

?>
<script type="text/javascript">
    alert("资料已修改，请点击返回列表！");
    document.location = "../admin_list_control.php";
</script>
<?
}
?>

</body>
</html>